home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 23
/
Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso
/
Aminet
/
text
/
edit
/
Smartindent.lha
/
Smartindent
/
Source
/
LibInit.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-12-14
|
4KB
|
147 lines
/*(( "Kopf" */
/* -----------------------------------------------------------------------------
$Id: LibInit.c,v 1.4 1997/06/29 19:24:13 mshopf Exp mshopf $
GoldED API client, ©1997 Matthias Hopf.
Compiled with SasC.
Library Inititalization
------------------------------------------------------------------------------
*/
/*)) */
/*(( "Includes" */
#include <exec/types.h>
#include <exec/memory.h>
#include <exec/libraries.h>
#include <exec/execbase.h>
#include <exec/resident.h>
#include <exec/initializers.h>
#include <dos/dosextens.h>
#ifdef __MAXON__
#include <clib/exec_protos.h>
#else
#include <proto/exec.h>
#endif
#include "compiler.h"
#include "smartindent.h"
#include "util.h"
/*)) */
/*(( "Prototypes" */
ULONG __saveds __stdargs L_OpenLibs(void);
void __saveds __stdargs L_CloseLibs(void);
extern struct SmartindentBase *SmartindentBase;
extern ULONG InitTab[];
extern APTR EndResident; /* below */
/*)) */
/*(( "Data" */
struct DosLibrary *DOSBase = NULL;
struct ExecBase *SysBase = NULL;
struct IntuitionBase *IntuitionBase = NULL;
struct GfxBase *GfxBase = NULL;
char __aligned SiLibName [] = LIBNAME;
char __aligned SiLibID [] = LIBID;
char __aligned Copyright [] = "(C) 1997 Matthias Hopf";
struct Resident __aligned ROMTag = /* do not change */
{
RTC_MATCHWORD,
&ROMTag,
&EndResident,
RTF_AUTOINIT,
VERSION,
NT_LIBRARY,
0,
&SiLibName[0],
&SiLibID[0],
&InitTab[0]
};
APTR EndResident;
struct MyDataInit /* do not change */
{
UWORD ln_Type_Init; UWORD ln_Type_Offset; UWORD ln_Type_Content;
UBYTE ln_Name_Init; UBYTE ln_Name_Offset; ULONG ln_Name_Content;
UWORD lib_Flags_Init; UWORD lib_Flags_Offset; UWORD lib_Flags_Content;
UWORD lib_Version_Init; UWORD lib_Version_Offset; UWORD lib_Version_Content;
UWORD lib_Revision_Init; UWORD lib_Revision_Offset; UWORD lib_Revision_Content;
UBYTE lib_IdString_Init; UBYTE lib_IdString_Offset; ULONG lib_IdString_Content;
ULONG ENDMARK;
} DataTab =
{
INITBYTE(OFFSET(Node, ln_Type), NT_LIBRARY),
0x80, (UBYTE) OFFSET(Node, ln_Name), (ULONG) &SiLibName[0],
INITBYTE(OFFSET(Library, lib_Flags), LIBF_SUMUSED|LIBF_CHANGED),
INITWORD(OFFSET(Library, lib_Version), VERSION),
INITWORD(OFFSET(Library, lib_Revision), REVISION),
0x80, (UBYTE) OFFSET(Library, lib_IdString), (ULONG) &SiLibID[0],
(ULONG) 0
};
/*)) */
/*(( "L_OpenLibs ()" */
/* Libraries not shareable between Processes or libraries messing
with RamLib (deadlock and crash) may not be opened here - open/close
these later locally and or maybe close them fromout L_CloseLibs()
when expunging !
*/
ULONG __saveds __stdargs L_OpenLibs(void)
{
SysBase = (*((struct ExecBase **) 4));
IntuitionBase = (struct IntuitionBase *) OpenLibrary("intuition.library", 37);
if(!IntuitionBase) return(FALSE);
GfxBase = (struct GfxBase *) OpenLibrary("graphics.library", 37);
if(!GfxBase) return(FALSE);
DOSBase = (struct DosLibrary *) OpenLibrary("dos.library", 37);
if(!DOSBase) return(FALSE);
ExecVersion = SysBase->LibNode.lib_Version;
if (ExecVersion >= 39)
MemAllocSmallFlags = MEMF_CLEAR | MEMF_REVERSE;
else
MemAllocSmallFlags = MEMF_CLEAR; /* Pre-V39 exec.library has a bug with MEMF_REVERSE */
return(TRUE);
}
/*)) */
/*(( "L_CloseLibs ()" */
void __saveds __stdargs L_CloseLibs(void)
{
if (DOSBase) CloseLibrary ((struct Library *) DOSBase);
if (GfxBase) CloseLibrary ((struct Library *) GfxBase);
if (IntuitionBase) CloseLibrary ((struct Library *) IntuitionBase);
DOSBase = NULL;
GfxBase = NULL;
IntuitionBase = NULL;
}
/*)) */